<?php

namespace Admin\Controller;

use Think\Controller;
use Org\Net\Http;

class IndexController extends Controller {
	public function index() {
		$recommend = M ( "Recommend" );
		$type = I ( 'type' ) == '' ? "Scenic" : I ( 'type' );
		$scenic = D ( $type );
		$arr = $scenic->where ( array (
				'id' => I ( 'content' ) 
		) )->find ();
		$data ['subtitle'] = $arr ['subtitle'];
		$data ['name'] = $arr ['name'];
		$data ['image'] = split ( ",", $arr ['image'] ) [0];
		$result = $recommend->add ( $data );
		if ($result) {
			$this->success ( "添加成功", U ( "Recommend/index" ) );
		} else {
			$this->error ( "添加失败" );
		}
	}
}